package net.sourceforge.peertwitter.core.events;

import rice.p2p.commonapi.Id;
import rice.p2p.commonapi.Message;

public class MessageDelivery implements Event {

	private Id id;
	private Message message;

	public MessageDelivery(Id id, Message message) {
		this.id = id;
		this.message = message;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((message == null) ? 0 : message.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		MessageDelivery other = (MessageDelivery) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (message == null) {
			if (other.message != null)
				return false;
		} else if (!message.equals(other.message))
			return false;
		return true;
	}

	public Message getMessage() {
		return this.message;
	}

	public Id getId() {
		return this.id;
	}
	
	
	
}
